﻿@using PagedList.Mvc
@using HtmlHelper = System.Web.WebPages.Html.HtmlHelper
@model  PagedList.IPagedList<DemoUserInfo.Models.Article>

@{
    ViewBag.Title = "文章";
    var tags = (List<string>)ViewData["tags"];
}

<h2> @ViewBag.Title </h2>
<div class="row">
    @foreach (var item in Model)
    {
        <div class="col-md-4 col-xs-6">
            <div class="col-md-9 col-md-offset-1">
                <div class="showcase">
                    <div class="showcase_time">
                        @item.Date.ToString("yy-MM-dd")
                        <span>@item.Tag</span>
                    </div>
                    <div class="showcase_img">
                        <small id="intro">
                            @item.Introduction
                        </small>
                        <a href=@Url.Action("Details", new {id = item.Id}) class="thumbnail">
                            <img src="@Url.Content(item.TitleImgSrc)">
                        </a>
                    </div>
                    <div class="caption showcase_text">
                        <blockquote><h4>@item.Title</h4></blockquote>
                    </div>
                </div>
            </div>
        </div>
    }
</div>
@if (tags.Count > 0)
{
    <div role="complementary">
        <nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm">
            <h1><small>分类</small></h1>
            <ul>
                @foreach (var item in tags)
                {
                    <li>
                        @Html.ActionLink(item, "Index", "Articles", new { tag = item, page = 1 }, new { })
                    </li>
                }
            </ul>
        </nav>
    </div>
}
<h6><small>Page @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber) of @Model.PageCount</small></h6>
@Html.PagedListPager(Model, page => Url.Action("Index", "Articles", new { tag = "", page }))
